#include "consumer.h"
#include "producer_consumer.h"
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void consume(request_list_container_t * list_container, request_t * req)
{
   pthread_mutex_lock(&(list_container->mutex));

   if (list_container->count < 1)
   {
      pthread_cond_wait(&(list_container->consumerCond), &(list_container->mutex));
   }

   list_container->remove(req);

   pthread_mutex_unlock(&(list_container->mutex));
   pthread_cond_signal(&(list_container->producerCond));
}
